//
//  ZMJLrc.m
//  Z-QQMusic
//
//  Created by zmj on 15/11/6.
//  Copyright © 2015年 zmj. All rights reserved.
//

#import "ZMJLrc.h"
/**
 *
 [ti:]
 [ar:]
 [al:]
 
 [00:00.89]传奇
 [00:02.34]作词：刘兵
 [00:03.82]作曲：李健
 [00:05.48]演唱：王菲
 [00:07.39]
 [00:33.20]只是因为在人群中多看了你一眼
 [00:40.46]再也没能忘掉你容颜
 [00:47.68]梦想着偶然能有一天再相见
 [00:55.29]从此我开始孤单思念
 [01:00.90]
 [01:02.38]想你时你在天边
 [01:09.86]想你时你在眼前
 */
@implementation ZMJLrc

+ (ZMJLrc *)lrcWithLrcLine:(NSString *)lrcLine {
    NSArray *temp = [lrcLine componentsSeparatedByString:@"]"];
    ZMJLrc *lrc = [[ZMJLrc alloc] init];
    lrc.lrcText = temp[1];
    // 处理时间字符串 "[00:33.20"
    NSString *timeStr = [temp[0] substringFromIndex:1];
    // 00:33.20
    // 01:09.86
    NSArray *timeArray = [timeStr componentsSeparatedByString:@":"];
    NSString *minute = timeArray[0];
    NSString *second = timeArray[1];
    lrc.time = [minute integerValue] * 60 + [second floatValue];
    return lrc;
}


@end
